package exam1;


public class AbstractFactoryTest {

    public static void main(String[] args) {
        Hamburg h = null;
        Cola c = null;
        AbstractFactory af = null;
        af = new MDNFactory();
        h = af.createHamburg();
        c = af.createCola();
        h.getHumburg();
        c.getCola();
        af = new KDJFactory();
        h = af.createHamburg();
        c = af.createCola();
        h.getHumburg();
        c.getCola();

    }

}
interface AbstractFactory{
    Hamburg createHamburg();
    Cola createCola();
}
class MDNFactory implements AbstractFactory{

    @Override
    public Hamburg createHamburg() {
        return new MDNHamburg();
    }

    @Override
    public Cola createCola() {
        return new MDNCola();
    }

}
class KDJFactory implements AbstractFactory{

    @Override
    public Hamburg createHamburg() {
        return new KDJHamburg();
    }

    @Override
    public Cola createCola() {
        return new KDJCola();
    }

}
interface Hamburg{
    void getHumburg();
}
class MDNHamburg implements Hamburg{

    @Override
    public void getHumburg() {
        System.out.println("MDNHamburg");
    }

}
class KDJHamburg implements Hamburg{

    @Override
    public void getHumburg() {
        System.out.println("KDJHamburg");
    }

}
interface Cola{
    void getCola();
}
class MDNCola implements Cola{

    @Override
    public void getCola() {
        System.out.println("MDNCola");
    }

}
class KDJCola implements Cola{

    @Override
    public void getCola() {
        System.out.println("KDJCola");
    }

}
